﻿using System;
using System.Collections.Generic;
using System.Text;

namespace ArgusPCLib.Threading.Collections
{
	public class SynchronizedEnumeratorWrapper<T> : SynchronizedEnumeratorBase<T>
	{
		IEnumerator<T> enumerator;

		public SynchronizedEnumeratorWrapper(IEnumerator<T> enumerator)
			: this(enumerator, new object()) { }

		public SynchronizedEnumeratorWrapper(IEnumerator<T> enumerator, object syncRoot)
			: base(syncRoot)
		{
			this.enumerator = enumerator;
		}

		public override T Current { get { return this.enumerator.Current; } }
		protected override bool MoveNextCore() { return this.enumerator.MoveNext(); }
		protected override void ResetCore() { this.enumerator.Reset(); }
	}
}
